define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'admin.spell/index',
        add_url: 'admin.spell/add',
        edit_url: 'admin.spell/edit',
        delete_url: 'admin.spell/delete',
        export_url: 'admin.spell/export',
        modify_url: 'admin.spell/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'ID'},                    {field: 'user_id', title: '用户ID'},                    {field: 'spell_group_id', title: '拼团商品ID'},                    {field: 'create_time', title: '添加时间'},                    {field: 'spellGroup.id', title: 'ID'},                    {field: 'spellGroup.master_name', title: '团长'},                    {field: 'spellGroup.goods_id', title: '商品ID'},                    {field: 'spellGroup.spell_group_name', title: '拼团名称'},                    {field: 'spellGroup.spell_group_profile', title: '拼团简介'},                    {field: 'spellGroup.unit', title: '单位'},                    {field: 'spellGroup.start_time', title: '活动日期'},                    {field: 'spellGroup.end_time', title: '结束时间'},                    {field: 'spellGroup.spell_group_results', title: '拼团实效'},                    {field: 'spellGroup.spell_group_number', title: '拼团人数'},                    {field: 'spellGroup.buy_number', title: '购买数量限制'},                    {field: 'spellGroup.sort', title: '排序'},                    {field: 'spellGroup.template_of_freight', title: '运费模板'},                    {field: 'spellGroup.active_state', title: '活动状态'},                    {field: 'spellGroup.status', title: '拼团状态', templet: ea.table.switch},                    {field: 'spellGroup.goods_property', title: '商品属性'},                    {field: 'spellGroup.create_time', title: '添加时间'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});